############################################################
(x,y) = (5,0)

try:
    print x
    print y
    z = x/y
except ZeroDivisionError:
    print "divide by zero"

############################################################
(x,y) = (5,0)
try:
    z = x/y
except ZeroDivisionError, e:
                                # representation: "<exceptions.ZeroDivisionError instance at 0x817426c>"
    print e.message             # output: "integer division or modulo by zero"

############################################################
    
class CustomError(Exception):
    def __init__(self, arg):
        
        # Set some exception infomation
        self.msg = arg
        
try:
    # Raise an exception with argument
    raise CustomError('This is a CustomError')
except CustomError, customObj:
    # Catch the custom exception
    print 'Error: ', customObj.msg
